public class College {
    private List<Building> buildings; // 聚合关系
    
    public College() {
        buildings = new ArrayList<>();
    }

    public void addBuilding(Building building) {
        buildings.add(building);
    }

    private List<Course> courses; // 组合关系
    
    public College() {
        courses = new ArrayList<>();
    }

    public void addCourse(Course course) {
        courses.add(course);
    }
}

public class Building {
    private String name;
    
    public Building(String name) {
        this.name = name;
    }

    // 构建其他属性和方法
}

public class Course {
    private String courseName;
    private Building location; // 约束性注释：课程必须在某个建筑中进行
    
    public Course(String courseName, Building location) {
        this.courseName = courseName;
        this.location = location;
        // 添加约束逻辑
    }

    // 构建其他属性和方法
}